<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:x="http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key">

  <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/>

  <xsl:include href="include/Slices.xslt"/>



  <xsl:template match="/">
    
    <FlowDocument PageWidth="21cm"
      PagePadding="60,40,40,40"
      PageHeight="29.7cm"
      ColumnWidth="21 cm">

      <xsl:call-template name="StyleSettings"/>

      <xsl:call-template name="SprintHeader">
        <xsl:with-param name="type" select="' - Plan x Done'"/>
        <xsl:with-param name="sprintNumber" select="$currentSprintNumber"/>
        <xsl:with-param name="context" select="/ProjectHourBankDataSet"/>
      </xsl:call-template>

 
      <Paragraph Style="{{StaticResource TitleParagraph}}">
        Sprint Balance
      </Paragraph>

      <xsl:call-template name="ItemPlanDone">
        <xsl:with-param name="plannedUnits"   select="/ProjectHourBankDataSet/Project/BacklogItem/BacklogItemHours[BaseLine=key('Sprint_By_SprintUId',SprintUId)/SprintNumber and SprintUId=/ProjectHourBankDataSet/Project/CurrentSprintUId]"/>
        <xsl:with-param name="doneUnits"   select="/ProjectHourBankDataSet/PayableTasks[Effort &gt; 0 and SprintUId=/ProjectHourBankDataSet/Project/CurrentSprintUId]"/>
      </xsl:call-template>


      <Paragraph Style="{{StaticResource TitleParagraph}}">
        <LineBreak/>
        Items Balance
      </Paragraph>
   

            <xsl:for-each select="/ProjectHourBankDataSet/Project/BacklogItem[BacklogItemHours/SprintUId=/ProjectHourBankDataSet/Project/CurrentSprintUId]">              
              <xsl:sort select="BacklogItemNumber" data-type="number"/>
              

              <xsl:variable name="backlogItemUId" select="BacklogItemUId"/>
              <xsl:variable name="backlogItemNumber" select="BacklogItemNumber"/>

              <xsl:call-template name="ItemPlanDone">
                <xsl:with-param name="number" select="BacklogItemNumber"/>
                <xsl:with-param name="title" select="Title"/>
                <xsl:with-param name="plannedUnits"   select="/ProjectHourBankDataSet/Project/BacklogItem[BacklogItemUId=$backlogItemUId]/BacklogItemHours[SprintUId=/ProjectHourBankDataSet/Project/CurrentSprintUId and BaseLine=$currentSprintNumber]"/>
                <xsl:with-param name="doneUnits"   select="/ProjectHourBankDataSet/PayableTasks[BacklogItemUId=$backlogItemUId and SprintUId=/ProjectHourBankDataSet/Project/CurrentSprintUId]"/>
              </xsl:call-template>

              



            </xsl:for-each>

       





 
    </FlowDocument>

  </xsl:template>




</xsl:stylesheet>